package com.cfx.exercise_32;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
public class TestIO2 {

	
	//控制台输入保存文件中
	public static void main(String[] args) throws IOException {
		
		/*StringBuilder sb = new StringBuilder();
		InputStream in = System.in;		
		int ch = 0;          
        while((ch=in.read())!=-1){                
//          在存储之前需要判断是否是换行标记 ,因为换行标记不存储。   
            if(ch=='\r')  
                continue;  
            if(ch=='\n'){  
                String temp = sb.toString();  
                if("over".equals(temp))  
                    break;  
                System.out.println(temp.toUpperCase());  
                sb.delete(0, sb.length());  
            }  
            else  
            //将读取到的字节存储到StringBuilder中。  
            sb.append((char)ch);
	}
	*/		
		File f = new File("C:/Users/zs/Desktop/控制台输入文字.txt");
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		FileWriter fw =  new FileWriter(f);
		BufferedReader br1 = new BufferedReader(new FileReader(f));
		InputStreamReader isr = new InputStreamReader(System.in);
		String line1 = null;
		String line = null;
				while((line1 = br1.readLine()) == null){
			while((line = br.readLine())!= null){
				if("over".equals(line)){
					break;
				}
				fw.write(line);
				fw.write("\n");
				fw.flush();
			}
			
		}
		
		fw.close();
		br.close();
	}
}
